package com.abtu.sms.course.service.impl;

import com.abtu.sms.course.mapper.CourseMapper;
import com.abtu.sms.course.service.CourrseService;
import com.abtu.sms.pojo.Course;
import com.abtu.sms.pojo.SelectCourse;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.SQLException;
import java.util.List;

@Service
public class CourseServiceImpl implements CourrseService {
    @Resource
    private CourseMapper courseMapper;

    @Override
    public int addOptionalCourse(Course course) throws SQLException {
        return courseMapper.addOptionalCourse(course);
    }

    @Override
    public Course findSelectCourseByCourseId(String cid) throws SQLException {
        return courseMapper.findSelectCourseByCourseId(cid);
    }

    @Override
    public int deleteCourseById(String cid) throws SQLException {
        System.out.println("--------------------------->" + cid);
        return courseMapper.deleteCourseById(cid);
    }

    @Override
    public List<Course> findMySelfOptionalCourse(String tid) throws SQLException {
        return courseMapper.findMySelfOptionalCourse(tid);
    }

    @Override
    public List<SelectCourse> findStudentSelectedCourseByCourseId(String cid) throws SQLException {
        return courseMapper.findStudentSelectedCourseByCourseId(cid);
    }

    @Override
    public SelectCourse findScoreByCourseIdAndStudentId(String cid, String sid) throws SQLException {
        return courseMapper .findScoreByCourseIdAndStudentId(cid,sid);
    }

    @Override
    public int upDateScoreByCidAndSid(String cid, String sid, String score) throws SQLException {
        return courseMapper.upDateScoreByCidAndSid(cid,sid,score);
    }
}
